home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Found / FWString / Include / FWStrs.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  22.3 KB  |  682 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWStrs.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    (c) 1993, 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWSTRS_H
  11. #define FWSTRS_H
  12.  
  13. #ifndef FWSTDDEF_H
  14. #include "FWStdDef.h"
  15. #endif
  16.  
  17. #ifndef FWEXCDEF_H
  18. #include "FWExcDef.h"
  19. #endif
  20.  
  21. #ifndef FWCHARIT_H
  22. #include "FWCharIt.h"
  23. #endif
  24.  
  25. #ifndef FWCHARAC_H
  26. #include "FWCharac.h"
  27. #endif
  28.  
  29. #if FW_LIB_EXPORT_PRAGMAS
  30. #pragma lib_export on
  31. #endif
  32.  
  33. //========================================================================================
  34. // Forward Declarations
  35. //========================================================================================
  36.  
  37. class FW_CLASS_ATTR FW_CStringReader;
  38. class FW_CLASS_ATTR FW_CStringWriter;
  39. class FW_CLASS_ATTR FW_CStringTool;
  40. class FW_CLASS_ATTR FW_CStringArchiver;
  41.  
  42. //========================================================================================
  43. //    CLASS FW_CByteString
  44. //
  45. //    String class implementations must satisfy the following requirements:
  46. //
  47. //    1) The string representation is kept in memory.
  48. //    2) The string representation is contiguous.
  49. //    3) The string is NUL-terminated.
  50. //
  51. //    FW_CByteString is an abstract base class that knows about bytes only, not characters.
  52. //========================================================================================
  53.  
  54. class FW_CLASS_ATTR FW_CByteString FW_AUTO_DESTRUCT_OBJECT
  55. {
  56.  public:
  57.  
  58.     FW_DECLARE_CLASS
  59.     
  60.     virtual ~ FW_CByteString();
  61.     FW_CByteString();    
  62.     FW_CByteString(const FW_CByteString &string);    
  63.  
  64.     FW_Byte* BytePositionInString(FW_ByteCount position);
  65.  
  66.     FW_ByteCount GetByteLength() const;
  67.  
  68.     FW_ByteCount GetCapacity() const;
  69.     
  70.     virtual FW_ByteCount GrowCapacity(FW_ByteCount capacityNeeded) = 0;
  71.         // Expand the string, if necessary, to capacityNeeded.
  72.         // Return the new capacity of the string, which may be less than capacityNeeded!
  73.         // The capacity of a string is never reduced (except by deleting the string).
  74.  
  75.     void Export(char* buffer) const;
  76.         // Copy contents of this string to external buffer.
  77.         // buffer will contain nul-terminated string.
  78.         // It is client's responsibility to ensure buffer is large enough.
  79.     
  80.  protected:
  81.  
  82.     virtual void PrivSetByteLength(FW_ByteCount bytes);
  83.  
  84.     void PrivNullTerminate();
  85.         // Append null byte to end of string
  86.  
  87.     void AppendBytes(const FW_Char* source, FW_ByteCount numberBytes);
  88.  
  89.     void DeleteBytes(FW_ByteCount numberBytes, FW_ByteCount position);
  90.         // Delete numberBytes bytes, starting at position.
  91.  
  92.     void InsertBytes(const FW_Char* bytes, 
  93.                      FW_ByteCount numberBytes,  
  94.                      FW_ByteCount position);
  95.  
  96.     virtual void ReplaceAllBytes(const FW_Char* string, FW_ByteCount numberBytes);
  97.  
  98.     void ReplaceBytes(const FW_Char* source,
  99.                       FW_ByteCount numberBytes,
  100.                       FW_ByteCount position);
  101.  
  102.     void RetrieveBytes(FW_Char* destination, 
  103.                        FW_ByteCount numberBytes,  
  104.                        FW_ByteCount position) const;
  105.  
  106.     void TruncateBytes(FW_ByteCount numberBytes);
  107.  
  108.  
  109.     FW_Byte*        fRepresentation;
  110.         
  111.     FW_ByteCount    fByteLength;
  112.         // Cached length in bytes.
  113.         // Must always be kept up to date, since GetByteLength is nonvirtual inline.
  114.         // Set by DeleteBytes, InsertBytes, ReplaceBytes
  115.  
  116.     FW_ByteCount    fCapacity;
  117.         // Cached capacity.
  118.         // Must always be kept up to date, since GetCapacity is nonvirtual inline.
  119.  
  120. };
  121.  
  122. //========================================================================================
  123. //    CLASS FW_CString
  124. //
  125. //    Characters in strings may occupy one, two, and possibly more bytes.
  126. //  The number of characters in the string is therefore not necessarily equal 
  127. //    to the number of bytes in the string. The field fCharWidth gives the number
  128. //    of bytes per character for a particular string. FW_CString assumes that all 
  129. //    characters in a string are the same width. In order to mix character sizes
  130. //    in a string, FW_CString must be subclassed.
  131. //
  132. //    The "length" of the string is measured in characters.
  133. //  The "byteLength" of the string is measured in bytes.
  134. //  The "capacity" of the string is measure in bytes.
  135. //
  136. //========================================================================================
  137.  
  138. class FW_CLASS_ATTR FW_CString : public FW_CByteString
  139. {
  140.   public:
  141.  
  142.     friend class FW_CLASS_ATTR FW_CStringReader;
  143.     friend class FW_CLASS_ATTR FW_CStringWriter;
  144.     friend class FW_CLASS_ATTR FW_CStringTool;
  145.     friend class FW_CLASS_ATTR FW_CStringArchiver;
  146.  
  147.     FW_DECLARE_CLASS
  148.     
  149.     virtual ~ FW_CString();
  150.     FW_CString();    
  151.     FW_CString(const FW_CString &string);    
  152.     FW_CString(FW_ByteCount charWidth);
  153.  
  154.     FW_CString& operator=(const FW_CString& string);
  155.     FW_CString& operator=(const FW_Char* string);
  156.     
  157.     FW_CharacterCount GetLength() const;
  158.  
  159.     FW_ByteCount GetCharWidth() const;
  160.  
  161.     operator const FW_Char*() const;
  162.         // Return a pointer to the first character in the string.
  163.         // Strings must be contiguous storage, and NUL-terminated!
  164.     
  165.     FW_Char operator[](FW_CharacterPosition position) const;
  166.         // Retrieve character at given position.
  167.         // Cannot be used on LHS of assignment.
  168.         // The NUL-terminator at position=fLength cannot be accessed.
  169.         
  170.     void Retrieve(FW_Char* destination, 
  171.                   FW_CharacterCount numberChars, 
  172.                   FW_CharacterPosition position) const;
  173.         // Retrieve numberChars of characters starting at position.
  174.         // Copy characters into the destination.
  175.         
  176.     void Delete(FW_CharacterCount numberChars, 
  177.                 FW_CharacterPosition position);
  178.         // Delete numberChars characters, starting at position.
  179.         
  180.     void Replace(const FW_Char* source, 
  181.                  FW_CharacterCount numberChars, 
  182.                  FW_CharacterPosition position);
  183.         // Replace numberChars of characters starting at position with the source.
  184.         // The client must ensure that the source characters are the same width as 
  185.         // those in the string.
  186.         
  187.     void Insert(const FW_Char* chars, 
  188.                 FW_CharacterCount numberChars,  
  189.                 FW_CharacterPosition position);
  190.         // Insert characters into string just before the character at positition.
  191.         // Insert at position GetLength() appends the characters.
  192.         // Insert at position 0 prepends the characters.
  193.     
  194.     void Insert(const FW_CString &string, FW_CharacterPosition position);
  195.         // Insert string at position.
  196.     
  197.     void ReplaceAll(const FW_CString &string);
  198.         // Replace entire contents of this string with string.
  199.     
  200.     void ReplaceAll(const FW_Char* items, FW_CharacterCount numberItems);
  201.         // Replace entire contents of this string with items.
  202.  
  203.     void ReplaceAll(const FW_Char* string);
  204.         // Replace entire contents of this string with (nul-terminated) string.
  205.     
  206.     void Append(const FW_CString &string);
  207.         // Append string onto end of this string.
  208.     
  209.     void Append(const FW_Char* items, FW_CharacterCount numberItems);
  210.         // Append items onto end of this string.
  211.     
  212.     void Append(const FW_Char* string);
  213.         // Append (nul-terminated) string onto end of this string.
  214.     
  215.     void Append(FW_Char character);
  216.     void Append(FW_WChar character);
  217.         // Append a single character onto the end of this string.
  218.         // Use the FW_WChar version for double-byte characters
  219.     
  220.     void Prepend(const FW_Char* items, FW_CharacterCount numberItems);
  221.         // Prepend items onto beginning of this string.
  222.         
  223.     void Prepend(const FW_CString &string);
  224.         // Prepend string onto beginning of this string.
  225.     
  226.     void Truncate(FW_CharacterPosition position);
  227.         // Truncate string at position.  Truncate(0) clears string.
  228.         
  229.     FW_CString& operator+=(const FW_CString &string);
  230.         // Append string onto the end of this string.
  231.         
  232.     FW_CString& operator+=(const FW_Char* items);
  233.         // Append (nul-terminated) items onto the end of this string.
  234.         
  235.     FW_CString& operator+=(FW_Char character);
  236.     FW_CString& operator+=(FW_WChar character);
  237.         // Append a single character onto the end of this string.
  238.         // Use the FW_WChar version for double-byte characters
  239.         
  240.     // ----- StringTool functions, passed through to current StringTool
  241.     //       These functions are convenience functions only, and will
  242.     //         work correctly only if both strings are of the same locale.
  243.     
  244.     void ToUpper();
  245.     void ToLower();
  246.  
  247.     FW_Boolean Substitute(const FW_CString &searchString,
  248.                           const FW_CString &substitutionString);
  249.     
  250.     FW_Boolean FindSubString(const FW_CString &subString,
  251.                              FW_CharacterPosition &foundPosition,
  252.                              FW_CharacterPosition startPosition=0) const;
  253.     
  254.     FW_Boolean FindCharacter(FW_Char character,
  255.                              FW_CharacterPosition &foundPosition,
  256.                              FW_CharacterPosition startPosition=0) const;
  257.     FW_Boolean FindCharacter(FW_LChar character,
  258.                              FW_CharacterPosition &foundPosition,
  259.                              FW_CharacterPosition startPosition=0) const;
  260.     
  261.     FW_Boolean FindWhiteSpace(FW_CharacterPosition &foundPosition,
  262.                               FW_CharacterPosition startPosition=0) const;
  263.                                          
  264.     FW_Boolean FindNonWhiteSpace(FW_CharacterPosition &foundPosition,
  265.                                  FW_CharacterPosition startPosition=0) const;
  266.                                          
  267.     FW_Boolean operator==(const FW_CString &string) const;
  268.     FW_Boolean operator==(const char *string) const;
  269.     FW_Boolean operator!=(const FW_CString &string) const;
  270.     FW_Boolean operator!=(const char *string) const;
  271.     FW_Boolean operator<(const FW_CString &string) const;
  272.     FW_Boolean operator<(const char *string) const;
  273.     FW_Boolean operator>(const FW_CString &string) const;
  274.     FW_Boolean operator>(const char *string) const;
  275.     FW_Boolean operator<=(const FW_CString &string) const;
  276.     FW_Boolean operator<=(const char *string) const;
  277.     FW_Boolean operator>=(const FW_CString &string) const;
  278.     FW_Boolean operator>=(const char *string) const;
  279.  
  280. #ifdef FW_BUILD_MAC
  281.   public:
  282.  
  283.     // ----- 'Pascal' strings for Macintosh toolbox
  284.  
  285.     void ExportPascal(FW_PascalChar* buffer) const;
  286.         // Copy contents of this string to external 'Pascal' buffer.
  287.         // buffer will contain Pascal string with length byte at buffer[0].
  288.         // It is client's responsibility to ensure buffer is large enough.
  289.  
  290.     void ReplaceAll(const FW_PascalChar* string);
  291.         // Replace entire contents of this string with pascal string.
  292. #endif
  293.  
  294.     virtual FW_ByteCount CharsToBytes(FW_CharacterCount numberChars,
  295.                                       FW_CharacterPosition position,
  296.                                       FW_ByteCount& bytePosition) const;
  297.         // Convert a character count and position to byte values.
  298.         // Client should override for strings with mixed-size characters.
  299.  
  300.   protected:
  301.  
  302.     virtual void ReplaceAllBytes(const FW_Char* string, FW_ByteCount numberBytes);
  303.  
  304.     virtual void PrivSetLength(FW_CharacterCount characters,
  305.                                FW_ByteCount bytes, 
  306.                                FW_ByteCount charWidth);
  307.  
  308.     void PrivSetLength(FW_CharacterCount characters, FW_ByteCount bytes);
  309.     void PrivSetLength(FW_CharacterCount characters);
  310.     
  311.     FW_Byte* GetBytePosition(FW_CharacterPosition position) const;
  312.         // Return a pointer to the specified character position in the string.
  313.  
  314.         
  315.     FW_CharacterCount    fLength;
  316.         // Cached length.
  317.         // Must always be kept up to date, since GetLength is nonvirtual inline.
  318.  
  319.     FW_ByteCount fCharWidth;
  320.         // Width of a character in bytes. Default value is sizeof(FW_Char) = 1.
  321.  
  322.   private:
  323.  
  324.     int Compare(const FW_CString &string) const;
  325.         // An implementation method.  Clients use comparison operators.
  326.         
  327. };
  328.  
  329. //========================================================================================
  330. //    CLASS FW_CDynamicString
  331. //========================================================================================
  332.  
  333. class FW_CLASS_ATTR FW_CDynamicString : public FW_CString
  334. {
  335.   public:
  336.  
  337.     FW_DECLARE_CLASS
  338.     
  339.     virtual ~ FW_CDynamicString();
  340.     FW_CDynamicString(FW_ByteCount capacity=0);
  341.     FW_CDynamicString(FW_ByteCount capacity, FW_ByteCount charWidth);
  342.     FW_CDynamicString(const FW_CDynamicString &string);
  343.     FW_CDynamicString(const FW_CString &string);
  344.     FW_CDynamicString(const FW_Char *items, FW_CharacterCount numberItems);
  345.     FW_CDynamicString(const FW_Char *items);
  346.  
  347.     FW_CString& operator=(const FW_CDynamicString &string);
  348.     FW_CString& operator=(const FW_CString& string);
  349.     FW_CString& operator=(const FW_Char* string);
  350.     
  351.     virtual FW_ByteCount GrowCapacity(FW_ByteCount capacityNeeded);
  352.         // Expand the string, if necessary to capacityNeeded.
  353.         // Return the new capacity of the string.
  354.         // The capacity of a string is never reduced (except by deleting the string).
  355.         
  356.   protected:
  357.  
  358.     void PrivResize(FW_ByteCount newCapacity);
  359.  
  360.   private:
  361.  
  362.     void AllocateRepresentation(FW_ByteCount capacity);
  363. };
  364.  
  365. //========================================================================================
  366. //    CLASS FW_CStringReader
  367. //========================================================================================
  368.  
  369. class FW_CLASS_ATTR FW_CStringReader : public FW_CTextReader
  370. {
  371.   public:
  372.     FW_CStringReader(const FW_CString &string);
  373.     FW_CStringReader(const FW_CString &string,
  374.                      FW_BytePosition start,
  375.                      FW_ByteCount length);
  376.     virtual ~ FW_CStringReader();
  377.  
  378.   protected:
  379.  
  380.     virtual void DoGetNextBuffer();
  381.         // Get another buffer from text data structure.
  382.         // Updates fStart and fLimit.
  383.         // Must ensure that fStart<=fLimit
  384.  
  385.     virtual void DoGetPreviousBuffer();
  386.         // Gets previous buffer from text data structure.
  387.         // Updates fStart and fLimit.
  388.         // Must ensure that fStart<=fLimit
  389.     
  390. };
  391.  
  392. //========================================================================================
  393. //    CLASS FW_CStringWriter
  394. //========================================================================================
  395.  
  396. class FW_CLASS_ATTR FW_CStringWriter : public FW_CTextWriter
  397. {
  398.   public:
  399.     enum {kDefaultBufferSize=32};
  400.  
  401.     virtual ~ FW_CStringWriter();
  402.     FW_CStringWriter(FW_CString &string, 
  403.                      FW_TextWriterMode mode=FW_kTextAppend,
  404.                      unsigned short bufferSize=kDefaultBufferSize);
  405.  
  406.   protected:
  407.  
  408.     virtual void DoFlushBuffer(FW_ByteCount bytesToFlush);    // Override
  409.         // Flush the current buffer.
  410.  
  411.     virtual void DoGetNextBuffer();    // Override
  412.         // Get another buffer from string, update fNext and fLimit.
  413.  
  414.  
  415.     FW_CString&            fString;
  416.     unsigned short        fBufferSize;
  417.     FW_TextWriterMode    fMode;            // FW_kTextWriteOver or FW_kTextAppend
  418.     FW_Byte*            fBuffer;
  419. };
  420.  
  421. //========================================================================================
  422. //    CLASS FW_CByteString inlines
  423. //========================================================================================
  424.  
  425. //----------------------------------------------------------------------------------------
  426. //    FW_CByteString::BytePositionInString
  427. //----------------------------------------------------------------------------------------
  428.  
  429. inline FW_Byte* FW_CByteString::BytePositionInString(FW_ByteCount position)
  430. {
  431.     return fRepresentation + position;
  432. }
  433.         
  434. //----------------------------------------------------------------------------------------
  435. //    FW_CByteString::Export
  436. //----------------------------------------------------------------------------------------
  437.  
  438. inline void FW_CByteString::Export(FW_Char* buffer) const
  439. {
  440.     FW_ASSERT(buffer != NULL);
  441.     FW_BlockMove(fRepresentation, (FW_Byte*) buffer, fByteLength+sizeof(FW_Char));
  442. }
  443.  
  444. //----------------------------------------------------------------------------------------
  445. //    FW_CByteString::GetByteLength
  446. //----------------------------------------------------------------------------------------
  447.  
  448. inline FW_ByteCount FW_CByteString::GetByteLength() const
  449. {
  450.     return fByteLength;
  451. }
  452.  
  453. //----------------------------------------------------------------------------------------
  454. //    FW_CByteString::GetCapacity
  455. //----------------------------------------------------------------------------------------
  456.  
  457. inline FW_ByteCount FW_CByteString::GetCapacity() const
  458. {
  459.     return fCapacity;
  460. }
  461.  
  462. //----------------------------------------------------------------------------------------
  463. //    FW_CByteString::PrivNullTerminate
  464. //----------------------------------------------------------------------------------------
  465.  
  466. inline void FW_CByteString::PrivNullTerminate()
  467. {
  468.     *((FW_Char*)(fRepresentation+fByteLength)) = FW_kNulCharacter;
  469. }
  470.  
  471. //========================================================================================
  472. //    CLASS FW_CString inlines
  473. //========================================================================================
  474.  
  475. //----------------------------------------------------------------------------------------
  476. //    FW_CString::GetBytePosition
  477. //----------------------------------------------------------------------------------------
  478.  
  479. inline FW_Byte* FW_CString::GetBytePosition(FW_CharacterPosition position) const
  480. {
  481.     return (FW_Byte*)(fRepresentation + position*fCharWidth);
  482. }
  483.  
  484. //----------------------------------------------------------------------------------------
  485. //    FW_CString::GetCharWidth
  486. //----------------------------------------------------------------------------------------
  487.  
  488. inline FW_ByteCount FW_CString::GetCharWidth() const
  489. {
  490.     return fCharWidth;
  491. }
  492.  
  493. //----------------------------------------------------------------------------------------
  494. //    FW_CString::GetLength
  495. //----------------------------------------------------------------------------------------
  496.  
  497. inline FW_CharacterCount FW_CString::GetLength() const
  498. {
  499.     return fLength;
  500. }
  501.  
  502. //----------------------------------------------------------------------------------------
  503. //    FW_CString::PrivSetLength
  504. //----------------------------------------------------------------------------------------
  505.  
  506. inline void FW_CString::PrivSetLength(FW_CharacterCount characters)
  507. {
  508.     fLength = characters;
  509. }
  510.  
  511. inline void FW_CString::PrivSetLength(FW_CharacterCount characters, FW_ByteCount bytes)
  512. {
  513.     fLength = characters;
  514.     PrivSetByteLength(bytes);    // ensures string is null-terminated
  515. }
  516.  
  517.  
  518. //----------------------------------------------------------------------------------------
  519. //    FW_CString::operator const FW_Char*
  520. //----------------------------------------------------------------------------------------
  521.  
  522. inline FW_CString::operator const FW_Char*() const
  523. {
  524.     return (const FW_Char*) fRepresentation;
  525. }
  526.  
  527. #ifdef FW_BUILD_MAC
  528. //----------------------------------------------------------------------------------------
  529. //    FW_CString::ExportPascal
  530. //----------------------------------------------------------------------------------------
  531.  
  532. inline void FW_CString::ExportPascal(FW_PascalChar* buffer) const
  533. {
  534.     FW_ASSERT(buffer != NULL);
  535.     FW_BlockMove(fRepresentation, (FW_Byte*)(buffer+1), fLength);
  536.     buffer[0] = (FW_PascalChar) fLength;
  537. }
  538. #endif
  539.  
  540. #ifdef FW_BUILD_MAC
  541. //----------------------------------------------------------------------------------------
  542. //    FW_CString::ReplaceAll
  543. //----------------------------------------------------------------------------------------
  544.  
  545. inline void FW_CString::ReplaceAll(const FW_PascalChar* items)
  546. {
  547.     ReplaceAllBytes((const FW_Char*)items+1, items[0]);
  548. }
  549. #endif
  550.  
  551. //----------------------------------------------------------------------------------------
  552. //    FW_CString::Insert
  553. //----------------------------------------------------------------------------------------
  554.  
  555. inline void FW_CString::Insert(const FW_CString& string, FW_CharacterPosition position)
  556. {
  557.     FW_ASSERT(string.GetCharWidth() == fCharWidth);
  558.     Insert(string, string.GetLength(), position);
  559. }
  560.  
  561. //----------------------------------------------------------------------------------------
  562. //    FW_CString::Append
  563. //----------------------------------------------------------------------------------------
  564.  
  565. inline void FW_CString::Append(const FW_CString& string)
  566. {
  567.     FW_ASSERT(string.GetCharWidth() == fCharWidth);
  568.     Insert(string, string.GetLength(), fLength);
  569. }
  570.  
  571. //----------------------------------------------------------------------------------------
  572. //    FW_CString::Append
  573. //----------------------------------------------------------------------------------------
  574.  
  575. inline void FW_CString::Append(const FW_Char* items, FW_CharacterCount numberItems)
  576. {
  577.     Insert(items, numberItems, fLength);
  578. }
  579.  
  580. //----------------------------------------------------------------------------------------
  581. //    FW_CString::Append
  582. //----------------------------------------------------------------------------------------
  583.  
  584. inline void FW_CString::Append(const FW_Char* string)
  585. {
  586.     Insert(string, FW_StringLength(string), fLength);
  587. }
  588.  
  589. //----------------------------------------------------------------------------------------
  590. //    FW_CString::Append
  591. //----------------------------------------------------------------------------------------
  592.  
  593. inline void FW_CString::Append(FW_Char character)
  594. {
  595.     FW_ASSERT(fCharWidth == sizeof(FW_Char));
  596.     Insert(&character, 1, fLength);
  597. }
  598.  
  599. inline void FW_CString::Append(FW_WChar character)
  600. {
  601.     FW_ASSERT(fCharWidth == sizeof(FW_WChar));
  602.     Insert((const FW_Char*)&character, 1, fLength);
  603. }
  604.  
  605. //----------------------------------------------------------------------------------------
  606. //    FW_CString::Prepend
  607. //----------------------------------------------------------------------------------------
  608.  
  609. inline void FW_CString::Prepend(const FW_Char* items, FW_CharacterCount numberItems)
  610. {
  611.     Insert(items, numberItems, 0);
  612. }
  613.  
  614.  
  615. //----------------------------------------------------------------------------------------
  616. //    FW_CString::Prepend
  617. //----------------------------------------------------------------------------------------
  618.  
  619. inline void FW_CString::Prepend(const FW_CString& string)
  620. {
  621.     FW_ASSERT(string.GetCharWidth() == fCharWidth);
  622.     Insert(string, string.GetLength(), 0);
  623. }
  624.  
  625.  
  626. //----------------------------------------------------------------------------------------
  627. //    FW_CString::operator+=
  628. //----------------------------------------------------------------------------------------
  629.  
  630. inline FW_CString& FW_CString::operator+=(const FW_CString& string)
  631. {
  632.     Append(string);
  633.     return *this;
  634. }
  635.  
  636. //----------------------------------------------------------------------------------------
  637. //    FW_CString::operator+=
  638. //----------------------------------------------------------------------------------------
  639.  
  640. inline FW_CString& FW_CString::operator+=(const FW_Char* string)
  641. {
  642.     Append(string);
  643.     return *this;
  644. }
  645.  
  646. //----------------------------------------------------------------------------------------
  647. //    FW_CString::operator+=
  648. //----------------------------------------------------------------------------------------
  649.  
  650. inline FW_CString& FW_CString::operator+=(FW_Char character)
  651. {
  652.     Append(character);
  653.     return *this;
  654. }
  655.  
  656. inline FW_CString& FW_CString::operator+=(FW_WChar character)
  657. {
  658.     Append(character);
  659.     return *this;
  660. }
  661.  
  662. //========================================================================================
  663. //    CLASS FW_CDynamicString inlines
  664. //========================================================================================
  665.  
  666. //----------------------------------------------------------------------------------------
  667. //    FW_CDynamicString::AllocateRepresentation
  668. //----------------------------------------------------------------------------------------
  669.  
  670. inline void FW_CDynamicString::AllocateRepresentation(FW_ByteCount capacity)
  671. {
  672.     fRepresentation = new FW_Byte[capacity+FW_kMedianCharacterSize];
  673.     fCapacity=capacity;
  674.     PrivSetLength(0,0);
  675. }
  676.  
  677. #if FW_LIB_EXPORT_PRAGMAS
  678. #pragma lib_export off
  679. #endif
  680.  
  681. #endif
  682.